Functions

Methods

Get Method List
  • Generally the SCRIPT has fewer  methods than the NODE.

  • Sometimes you can use the SCRIPT for a faster lookup, but sometimes the desired functions only appear on the NODE.

print((get_script() as Script).get_method_list().size())    ## 104
print(get_method_list().size())                             ## 194

Set / Get

@export var surfaceColors: PackedFloat32Array = [1.0] :
    get:
        return surfaceColors
    set(value):
        surfaceColors = value

Lambda Functions

area.area_entered.connect(func(area : Area2D):
    #code
    )

Callables

  • Great explanation .

    • Very cool.

    • Demonstrated uses:

      • Function to profile execution time of other functions.

      • Function to periodically emit another function.

      • Array .map()  method.

      • Array .filter()  method.